package com.lqq.demo6;

public class Book {
    int id;
    String name;
    double price;
    int number;
    String author;
    Press press;

    public Book() {
    }

    public Book(int id, String name, double price, int number, String author, Press press) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.number = number;
        this.author = author;
        this.press = press;
    }

    public void print(){
        System.out.println("编号：" + id);
        System.out.println("名称：" + name);
        System.out.println("单价：" + price);
        System.out.println("数量：" + number);
        System.out.println("作者：" + author);
        if(press == null){
            System.out.println("null");
        }else{
            press.print();
        }
    }
}
